package com.joysuch.wwyt.risk.mapper;

import com.joysuch.wwyt.core.support.Context;
import com.joysuch.wwyt.risk.entity.RiskMeasureType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.joysuch.wwyt.risk.entity.vo.RiskMeasureTypeNode;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author heqifeng
 * @since 2021-09-10
 */
@Mapper
public interface RiskMeasureTypeMapper extends BaseMapper<RiskMeasureType> {

    List<RiskMeasureType> getTopTypes(String orgCode, Long tenentId);

    int countAllByParentId(@Param("parentId") Long parentId);

    int selectSameNameForTopType(@Param("nameList") List<String> nameList,String orgCode, Long tenentId);

    String findNameById(Long id);

    Integer getMaxTypeLevel(String orgCode, Long tenentId);

    List<String> getNamesByTypeLevel(Integer typeLevel, String orgCode, Long tenentId);

    List<Long> getLastEvaluationIds(String orgCode, Long tenentId);

    List<RiskMeasureType> getAllByTypeLevel(@Param("typeLevel")Integer typeLevel,String orgCode, Long tenentId);

    List<RiskMeasureType> getAll( String orgCode, Long tenentId);

    /**
     * 根据上级id查下所有下属id列表
     * @param parentId
     * @return
     */
    List<Long> getAllIdsByPid(Long parentId);
}
